﻿using System;

namespace AbpIronyDemo
{
    using Abp;
    using Abp.Modules;
    using Abp.Reflection.Extensions;

    using AbpPlusPlus;
    using AbpPlusPlus.Evaluations;

    class Program
    {
        static void Main(string[] args)
        {
            var abpBoot = AbpBootstrapper.Create<IronyDemoModule>();
            abpBoot.Initialize();

            var expression = new[]
                          {
                              "2.5+(3-1)*5/2+2.5",
                              "(2/3)/(1/2)-(1/4)*(2/5)",
                              "9.9*6.4-(2.5+0.24)",
                              "6.5*9.5+6.5*0.5 "
                          };

            var evaluator = abpBoot.IocManager.Resolve<IEvaluator>();
            foreach (var s in expression)
            {
                var evaluation = evaluator.Evaluate(s);
                Console.WriteLine($"({evaluation.ToString()}) 等于 {evaluation.Value}");
            }
           

            Console.WriteLine("Hello World!");
            Console.ReadKey(true);
        }
    }

    [DependsOn(typeof(AbpIronyModule))]
    public class IronyDemoModule
        : AbpModule
    {
        public override void PreInitialize()
        {
            
        }

        public override void Initialize()
        {
            this.IocManager.RegisterAssemblyByConvention(typeof(IronyDemoModule).GetAssembly());
        }
    }
}
